#include "stdafx.h"
#include "displaylist.h"

namespace GLC {

static const int LISTS_COUNT = 1; // forever alone

DisplayList::DisplayList()
{
    _handle = glGenLists(LISTS_COUNT);
}

DisplayList::~DisplayList()
{
    glDeleteLists(_handle, LISTS_COUNT);
}

void DisplayList::begin(bool runOnceCompiling) const
{
    glNewList(_handle, (runOnceCompiling ? GL_COMPILE_AND_EXECUTE : GL_COMPILE));
}

void DisplayList::end() const
{
    glEndList();
}

void DisplayList::call() const
{
    glCallList(_handle);
}

} // namespace GLC
